<table id ='tables'>
<tr>
<th rowspan=2>STT</th>
<th rowspan=2>Đội</th>
<th rowspan=2>Địa Điểm</th>
<th rowspan=2>Ngày</th>
<th rowspan=2>Thành viên tham gia</th>
<th colspan=<?php echo count($hanghoas)?>>Chỉ tiêu</th>
<th rowspan=2>Ghi chú</th>
<th rowspan=2>Thao tác</th>
</tr>
<tr>
<?php foreach ($hanghoas as $keyhh =>$valhh):?>
<th><?php echo $valhh ?></th>
<?php endforeach;?>
</tr>
<?php
	$i=0; 
	 foreach ($chitieungays as $chitieungay):
	  $i++;
?>
<tr>
<td><?php echo $i?></td>
<td><?php echo $chitieungay['Kehoachbhld']['tendoi']?></td>
<td><?php echo $chitieungay['Kehoachbhld']['diadiem']?></td>
<td><?php echo date('d-m-Y',strtotime($chitieungay['Kehoachbhld']['thoigian']))?></td>
<td><?php echo $chitieungay['Kehoachbhld']['nhansu']?></td>
<?php foreach ($hanghoas as $keyhh =>$valhh):?>
<td>
<?php
	foreach ($chitieungay['Chitieungay'] as $ctngay)
	{
		if($ctngay['hanghoa_id']==$keyhh)
 			echo $ctngay['ketqua'];	
	}
?>
</td>
<?php endforeach;?>
<td><?php echo $chitieungay['Kehoachbhld']['ghichu']?></td>
<td>
<?php echo $html->link('Sửa kết quả bán hàng',array('controller'=>'chitieungays','action'=>'nhapkqbanhang',$chitieungay['Kehoachbhld']['nhanvien_id']));?>
</td>
</tr>
<?php endforeach;?> 
</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>